<template>
  <el-dialog
    v-model="visible"
    :close-on-click-modal="false"
    title="订单详情"
    draggable
    :loading="loading"
  >
    <el-table :data="detailsList" style="width: 100%">
      <el-table-column prop="mobile" label="手机号" align="center" />
      <el-table-column prop="comboName" width="120" label="餐食名称" align="center" />
      <el-table-column prop="comboNum" label="份数" align="center" />
      <el-table-column prop="comboPrice" label="餐食价格" sortable align="center" />
      <el-table-column prop="enterpriseName" label="酒店名称" align="center" />
      <el-table-column prop="remark" label="房间号/工位号" align="center" />
      <el-table-column prop="createTime" label="创建时间" align="center" />
    </el-table>
    <pagination
      v-show="total > 0"
      :total="total"
      v-model:page="queryParams.pageNum"
      v-model:limit="queryParams.pageSize"
      @pagination="getList"
    />
  </el-dialog>
</template>
<script setup>
import { getEnterpriseOrderApi } from '@/api/system/membercenter'
import { ref } from 'vue'

const props = defineProps({
  dialogId: {
    type: String
  }
})
const visible = ref(false)
const loading = ref(false)
const total = ref(0)
const queryParams = ref({
  pageNum: 1,
  pageSize: 10,
  clientId: null
})
const detailsList = ref([])

/**获取列表数据 */
function getList() {
  loading.value = true
  getEnterpriseOrderApi({ ...queryParams.value })
    .then((res) => {
      console.log(res)
      detailsList.value = res.data.rows || []
      total.value = res.data.total || 0
    })
    .finally(() => {
      loading.value = false
    })
}
/**初始化 */
function init(id) {
  queryParams.value.clientId = id
  getList()
  visible.value = true
}

defineExpose({
  init
})
</script>
<style lang="scss" scoped>
:deep(.el-pagination) {
  right: 20px !important;
}
</style>
